﻿<Window x:Class="CECB.Activity.Project_Activity_Insert_Window"
        
        Title="Project_Activity_Insert_Window"  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         
         xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
       
          WindowStartupLocation="CenterScreen"   Background="#AA000000" 
        AllowsTransparency="True" WindowStyle="None" WindowState="Maximized"
        mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">

    <Window.Resources>
        <Storyboard x:Key="drop">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="groupBox">
                <EasingDoubleKeyFrame KeyTime="0" Value="0.02"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1.194">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <BackEase EasingMode="EaseOut" Amplitude="-3"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="groupBox">
                <EasingDoubleKeyFrame KeyTime="0" Value="-120"/>
                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="23.75">
                    <EasingDoubleKeyFrame.EasingFunction>
                        <BackEase EasingMode="EaseOut" Amplitude="-3"/>
                    </EasingDoubleKeyFrame.EasingFunction>
                </EasingDoubleKeyFrame>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        <ControlTemplate x:Key="AnimatedExpanderButtonTemp" TargetType="{x:Type ToggleButton}">
            <Border x:Name="ExpanderButtonBorder"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Padding="{TemplateBinding Padding}"
                    >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Rectangle Fill="Transparent"
                               Grid.ColumnSpan="2"/>
                    <Ellipse Name="Circle"
                         Grid.Column="0"
                         Stroke="DarkGray"
                         Width="20"
                         Height="20"
                         HorizontalAlignment="Center"
                         VerticalAlignment="Center"
                         />
                    <Path x:Name="Arrow"
                      Grid.Column="0"
                      Data="M 1,1.5 L 4.5,5 8,1.5"
                      Stroke="#FF666666"
                      StrokeThickness="2"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center"
                      RenderTransformOrigin="0.5,0.5"
                      >
                        <Path.RenderTransform>
                            <RotateTransform Angle="0"/>
                        </Path.RenderTransform>
                    </Path>
                    <ContentPresenter x:Name="HeaderContent"
                                      Grid.Column="1"
                                      Margin="4,0,0,0"
                                      ContentSource="Content"/>
                </Grid>
            </Border>
            <ControlTemplate.Triggers>
                <!-- Animate arrow when toggled-->
                <Trigger Property="IsChecked"
                         Value="True">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="Arrow"
                                                 Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                 To="180"
                                                 Duration="0:0:0.4"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="Arrow"
                                                 Storyboard.TargetProperty="(Path.RenderTransform).(RotateTransform.Angle)"
                                                 To="0"
                                                 Duration="0:0:0.4"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.ExitActions>
                </Trigger>

                <!-- MouseOver, Pressed behaviours-->
                <Trigger Property="IsMouseOver"
                                 Value="true">
                    <Setter Property="Stroke"
                                    Value="#FF3C7FB1"
                                    TargetName="Circle"/>
                    <Setter Property="Stroke"
                                    Value="#222"
                                    TargetName="Arrow"/>
                </Trigger>
                <Trigger Property="IsPressed"
                                 Value="true">
                    <Setter Property="Stroke"
                                    Value="#FF526C7B"
                                    TargetName="Circle"/>
                    <Setter Property="StrokeThickness"
                                    Value="1.5"
                                    TargetName="Circle"/>
                    <Setter Property="Stroke"
                                    Value="#FF003366"
                                    TargetName="Arrow"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <ControlTemplate x:Key="StretchyExpanderTemp" TargetType="{x:Type Expander}">
            <DockPanel>
                <ToggleButton x:Name="ExpanderButton" 
                              DockPanel.Dock="Top"
                              Template="{StaticResource AnimatedExpanderButtonTemp}"
                              Content="{TemplateBinding Header}"
                              IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
                              OverridesDefaultStyle="True"
                              Padding="1.5,0">
                </ToggleButton>
                <ContentPresenter x:Name="ExpanderContent"
                                  ContentSource="Content"
                                  DockPanel.Dock="Bottom"
                                  >
                    <ContentPresenter.LayoutTransform>
                        <ScaleTransform ScaleY="0"/>
                    </ContentPresenter.LayoutTransform>
                </ContentPresenter>
            </DockPanel>
            <ControlTemplate.Triggers>
                <Trigger Property="IsExpanded" Value="True">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="ExpanderContent"
                                                 Storyboard.TargetProperty="(ContentPresenter.LayoutTransform).(ScaleTransform.ScaleY)"                                                 
                                                 To="1"
                                                 Duration="0:0:0.4"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                    <Trigger.ExitActions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="ExpanderContent"
                                                 Storyboard.TargetProperty="(ContentPresenter.LayoutTransform).(ScaleTransform.ScaleY)"
                                                 To="0"
                                                 Duration="0:0:0.4"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.ExitActions>
                </Trigger>

            </ControlTemplate.Triggers>
        </ControlTemplate>



    </Window.Resources>

    <Grid VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,40,0,0" Width="1000" Height="700">
        <Rectangle Margin="25,25,25,12" Stroke="White" RadiusY="19.5" RadiusX="19.5" StrokeThickness="4" Width="950">
            <Rectangle.Effect>
                <DropShadowEffect Direction="330" BlurRadius="24" ShadowDepth="13" />
            </Rectangle.Effect>
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="Black" Offset="0" />
                    <GradientStop Color="#FFA3A1A1" Offset="0.494" />
                    <GradientStop Color="#FF272121" Offset="0" />
                    <GradientStop Color="#FF272121" Offset="1" />
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <StackPanel Margin="30,40,0,0" Orientation="Vertical">
            <StackPanel Orientation="Horizontal">
                <TextBlock FontSize="35" Margin="10,0,0,0" FontStyle="Italic" FontWeight="ExtraBold" Foreground="White" Height="55" Name="textBlock1" Text="Insert Project Activities" Width="auto" />
            </StackPanel>
            <GroupBox Width="428" MaxHeight="600" HorizontalAlignment="Left">

                <ScrollViewer VerticalAlignment="Top" HorizontalAlignment="Left" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Hidden">
                    <StackPanel Orientation="Vertical" Margin="1,8,0,0">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock FontSize="16" Margin="10,0,0,0" Foreground="White" Height="auto"   Text="Select a project" Width="auto" />
                            <toolkit:AutoCompleteBox Margin="10,0,0,0" Background="White" BorderBrush="#FFF8F8F8" BorderThickness="2" FilterMode="Contains" FontSize="18" Height="30" IsTabStop="True" ItemsSource="{Binding}" Name="ProjectAutocompleteTextBox" Opacity="1" TabIndex="1" UseLayoutRounding="False" ValueMemberPath="proj_name" Width="270" SelectionChanged="ProjectAutocompleteTextBox_SelectionChanged">
                                <toolkit:AutoCompleteBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <TextBlock Text="{Binding Path=proj_reference}" />
                                            <TextBlock Text=" - " />
                                            <TextBlock Text="{Binding Path=proj_name}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </toolkit:AutoCompleteBox.ItemTemplate>
                            </toolkit:AutoCompleteBox>

                        </StackPanel>
                        <StackPanel Margin="0,5,0,0" Orientation="Horizontal" Width="400" Height="auto" Background="#FFFFE8A6" HorizontalAlignment="Left">
                            <Expander Template="{StaticResource StretchyExpanderTemp}"
                  OverridesDefaultStyle="True"
            Header="  View more project details" Height="auto"    HorizontalAlignment="Left" Margin="0,0,0,10" Name="expander1" VerticalAlignment="Top" Width="400" Background="{x:Null}">
                                <StackPanel Width="400" Height="90" Background="Maroon" VerticalAlignment="Top" HorizontalAlignment="Left">
                                    <WrapPanel Name="ProjectDetailsWrapPanel" Margin="0,0,0,0" Orientation="Vertical" Height="auto" Background="DimGray" OpacityMask="{x:Null}">
                                        <WrapPanel Height="25" Margin="10,5,0,0">
                                            <TextBlock Height="auto" Name="textBlock3" Text="Project Reference: "    TextAlignment="Right"   FontSize="14" Foreground="White"  Width="150"  Background="#FF3E3832" VerticalAlignment="Stretch" />
                                            <Label Content="{Binding Path=proj_reference}" Padding="5,-2,0,0" Height="auto" FontSize="14" Foreground="#FF3E3832" Name="labelProjectReference" Margin="10,0,0,0" Width="220" VerticalAlignment="Top" Background="#FFF0F0F0"  BorderBrush="#FFB4B4B4" BorderThickness="1" />
                                        </WrapPanel>
                                        <WrapPanel Height="25"  Margin="10,5,0,0"  >
                                            <TextBlock Height="auto" Name="textBlock6" Text="Project Team: "  TextAlignment="Right" FontSize="14" Foreground="White"  Width="150" Background="#FF3E3832" VerticalAlignment="Stretch" />
                                            <Label Content="{Binding Path=proj_consultant}" Padding="5,-2,0,0" Height="auto" FontSize="14" Foreground="#FF3E3832" Name="label6" Margin="10,0,0,0" Width="220" VerticalAlignment="Top" Background="#FFF0F0F0" BorderBrush="#FFB4B4B4" BorderThickness="1" />
                                        </WrapPanel>
                                        <WrapPanel Height="25"  Margin="10,5,0,0"  >
                                            <TextBlock Height="auto" Name="textBlock5" Text="Project Category: " TextAlignment="Right"  FontSize="14" Foreground="White"  Width="150" Background="#FF3E3832" VerticalAlignment="Stretch" />
                                            <Label Content="{Binding Path=ProjectTypes.ptype_name}" Padding="5,-2,0,0" Height="auto" FontSize="14" Foreground="#FF3E3832" Name="label3" Margin="10,0,0,0" Width="220" VerticalAlignment="Top" Background="#FFF0F0F0" BorderBrush="#FFB4B4B4" BorderThickness="1" />
                                        </WrapPanel>
                                    </WrapPanel>

                                </StackPanel>
                            </Expander>
                        </StackPanel>
                        <StackPanel Margin="0,5,0,0" Background="#FFFFE8A6" HorizontalAlignment="Left" Height="auto" Width="400">
                            <Expander Template="{StaticResource StretchyExpanderTemp}"
                  OverridesDefaultStyle="True"
            Header="  View existing activities" Height="auto" HorizontalAlignment="Left" Margin="0,0,0,10" Name="expander2" VerticalAlignment="Top" Width="400">
                                <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                                    <TreeView Height="400" HorizontalAlignment="Left" Margin="5,0,0,0" Name="treeViewActivities" VerticalAlignment="Top" Width="380" Background="#FFC2CCDB"   BorderBrush="White" />
                                      </ScrollViewer>
                            </Expander>
                        </StackPanel>
                        <StackPanel Margin="0,5,0,0" Background="#FFFFE8A6" HorizontalAlignment="Left" Height="auto" Width="400">
                            <!--<Expander Template="{StaticResource StretchyExpanderTemp}"
                  OverridesDefaultStyle="True"
            Header="  View newly added activities" IsExpanded="True" Height="auto"    HorizontalAlignment="Left" Margin="0,0,0,10" Name="expander3" VerticalAlignment="Top" Width="390">

                                <ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalAlignment="Left" Height="300" Width="380">
                                   
                                </ScrollViewer>

                            </Expander>-->
                            <StackPanel Orientation="Vertical" Width="400" Height="auto" Background="AliceBlue" VerticalAlignment="Top" HorizontalAlignment="Left">

                                <DataGrid  ItemsSource="{Binding ModelListe}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" AutoGenerateColumns="False" Background="#FFF0F0F0" Height="auto" MaxHeight="300" HorizontalAlignment="Left" Margin="0,0,0,0" Name="dataGrid1" VerticalAlignment="Top" Width="400" BorderThickness="0" CanUserDeleteRows="True" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" CanUserReorderColumns="False" ColumnHeaderHeight="30"  IsReadOnly="True" MinHeight="25" RowBackground="#FFBEBBBB" SelectionMode="Single" VerticalGridLinesBrush="#FF3E3832" FontSize="14" HorizontalContentAlignment="Left">
                                    <DataGrid.Columns>
                                        <DataGridTextColumn Binding="{Binding actv_phase}" CanUserReorder="False" Header="Component" Width="0" Visibility="Hidden" />
                                        <DataGridTextColumn Binding="{Binding actv_name}" CanUserReorder="False" Header="Activities" MinWidth="400" Width="auto" />
                                    </DataGrid.Columns>

                                </DataGrid>
                            </StackPanel>
                            <StackPanel Width="400" Height="48" Background="#FF3E3832">
                                <Button Background="{x:Null}" HorizontalAlignment="Right" BorderBrush="White" Click="CloseButton_Click" Height="44" Margin="2,2" Name="CloseButton" Width="98">
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <Image Grid.Column="0" Height="32" Margin="2" Source="/CECB;component/images\close.png" Width="32" />
                                        <StackPanel Grid.Column="1" HorizontalAlignment="Stretch" Margin="2" VerticalAlignment="Center">
                                            <TextBlock Margin="0" Padding="0" Foreground="White" Text="Remove" TextWrapping="NoWrap" />
                                        </StackPanel>
                                    </Grid>
                                </Button>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </ScrollViewer>
                
            </GroupBox>

        </StackPanel>
        <GroupBox Margin="461,95,35,0" Height="99" VerticalAlignment="Top">
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal" Margin="0,6,0,0" Background="#FF3E3832">
                    <TextBlock Height="25" Name="textBlock23" Text="Select Phase: "   FontSize="18" Foreground="White"  Width="150" TextAlignment="Right" />
                    <ComboBox Height="23" Name="comboBoxComponents" Width="285" Margin="10,0,0,0" Background="#FFFFE8A6" DropDownOpened="comboBoxComponents_DropDownOpened">
                        <ComboBoxItem Content="Preconstriction &amp; Mobilization" />
                        <ComboBoxItem Content="Constriction Phase" />
                        <ComboBoxItem Content="Operation &amp; Maintenance Phase" />
                    </ComboBox>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Background="#FF3E3832" Height="63">
                    <TextBlock Height="25" Name="textBlock32" Text="Add New Activity: "   FontSize="18" Foreground="White"  Width="150" TextAlignment="Right" />
                    <TextBox TextWrapping="Wrap" AcceptsReturn="True" Height="59" Name="textBoxAddActivity"  FontSize="14" Foreground="Black"  Width="286"  Margin="10,0,0,0" TextChanged="textBoxAddActivity_TextChanged"   Background="#FFF0F0F0" PreviewTextInput="textBoxAddActivity_PreviewTextInput" PreviewKeyDown="textBoxAddActivity_PreviewKeyDown" />
                    <Button Margin="0,33,0,0" Content="Save" Height="23" Name="button1"   Width="44" Click="button1_Click" Background="#FF3E3832" Foreground="#FFFFF8F8" BorderBrush="White" BorderThickness="2" />
                </StackPanel>
            </StackPanel>
        </GroupBox>
        <GroupBox Margin="461,198,35,88">
            <StackPanel   Height="406" Name="stackPanel2" VerticalAlignment="Top" Orientation="Vertical" >
                <WrapPanel Orientation="Vertical" >


                    <TextBlock Height="25" Name="ads" Text="Add Existing Activity: " HorizontalAlignment="Left"  FontSize="18" Foreground="White"  Width="177" TextAlignment="Right" />
                    <TextBox Grid.Column="2"   Width="486" Margin="6,10,0,0" Height="30" Name="textBoxActivitySearch" VerticalAlignment="Top" FontSize="18" Background="White" Opacity="1" HorizontalAlignment="Center" TextChanged="textBoxActivitySearch_TextChanged" PreviewKeyDown="textBoxActivitySearch_PreviewKeyDown" />
                   
                </WrapPanel>

                <GroupBox x:Name="groupBox" Margin="0,0,0,0" BorderThickness="0" MaxHeight="320" Width="476">
                    <GroupBox.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </GroupBox.RenderTransform>
                    <WrapPanel MaxWidth="500" Margin=" 0,-20,0,0" HorizontalAlignment="Left">
                        <ListBox x:Name="listBoxActivities" ScrollViewer.CanContentScroll="False" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Height="290" Background="DimGray" Width="479" SelectionChanged="listBoxActivities_SelectionChanged">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <WrapPanel Background="#FF3E3832" MaxWidth="500">
                                        <StackPanel Orientation="Horizontal" MaxWidth="500">
                                            <!--<CheckBox IsChecked="{Binding Deleteable, Mode=TwoWay}" Name="CheckBoxActivity" VerticalAlignment="Center" HorizontalAlignment="Left"  />-->
                                            <WrapPanel Orientation="Vertical" MaxWidth="500">
                                                <Label Content="{Binding actv_name}" Height="30" Width="500" Foreground="White"   HorizontalAlignment="Left" FontSize="15" />
                                                <Label Content="{Binding actv_phase}" Height="22" Width="500" Foreground="White"   HorizontalAlignment="Right" FontSize="10" />
                                            </WrapPanel>
                                        </StackPanel>
                                    </WrapPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </WrapPanel>
                </GroupBox>


            </StackPanel>
        </GroupBox>
         
            <Button Background="{x:Null}" Margin="856,620,41,25" BorderBrush="White" Click="SaveButton_Click" Height="44"   Name="SaveButton">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Image Grid.Column="0" Height="32" Margin="2" Source="/CECB;component/images/Save.png" Width="32" />
                    <StackPanel Grid.Column="1" HorizontalAlignment="Stretch" Margin="2" VerticalAlignment="Center">
                        <TextBlock Margin="0" Padding="0" Foreground="White" Text="Save" TextWrapping="NoWrap" />
                    </StackPanel>
                </Grid>
            </Button>
        <Grid HorizontalAlignment="Center" VerticalAlignment="Top" Margin="860,35,-32,0">
            <Image Height="32" Margin="2" Source="/CECB;component/images/closeblack.png"  Width="32" MouseLeftButtonDown="Image_MouseLeftButtonDown" />
        </Grid>
    </Grid>
</Window>
